package chances.system.operator.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.StringUtils;

@Entity
@Table(name = "CS_SYS_ENUMDATA")
public class EnumData {

	public static final int TYPE_TEXT = 1;
	public static final int TYPE_HQL = 2;

	public static final int ENABLED = 1;
	public static final int DISABLED = 0;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	// 数据名称
	@Column(name = "DATA_NAME", length = 128, nullable = false)
	private String name;

	// 数据代码
	@Column(name = "DATA_CODE", length = 64)
	private String code;

	// 数据值
	@Column(name = "DATA_VALUE", length = 64)
	private String value;

	// 数据父id
	@Column(name = "DATA_PARENT_ID")
	private Long parentId;

	// 数据状态
	@Column(name = "DATA_STATUS")
	private Integer status;

	// 类型
	@Column(name = "TYPE")
	private Integer type;

	@Transient
	private Integer count;
	
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		if (StringUtils.isNotBlank(name))
			this.name = name;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public Long getParentId() {
		return parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getCount() {
		return count;
	}

	public void setCount(Integer count) {
		this.count = count;
	}

}
